<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>File Upload</title>
       <script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/3.1.3/socket.io.js"></script>
</head>
<body>
    <h1>File Upload</h1>
    <form action="{{ url_for('upload') }}" method="post" enctype="multipart/form-data">
        <input type="file" name="file" required>
        <input type="submit" value="Upload">
    </form>
 <script>
        var socket = io.connect('http://' + document.domain + ':' + location.port);

        // 客户端连接成功后触发的事件
        socket.on('connect', function() {
            console.log('Connected to server');
        });

        // 客户端断开连接后触发的事件
        socket.on('disconnect', function() {
            console.log('Disconnected from server');
        });
    </script>
</body>
</html>
